#include "head.h"

struct CommandMap CmdMap[CmdCount];

char command[255], argu[255];
char ErrorMessage[255];
char InputBuf[InputBufSize]; /* Stores command and argument. */
char pMessageBuffer[MessageBufferSize];
char HostName[255];
int  PortNumber;
int  sockfd;

#include "Prompt.c"
#include "Preprocess.c"
#include "Dispatch.c"
#include "ProcessError.c"
#include "ProcessCcd.c"
#include "ProcessCls.c"
#include "ProcessExit.c"
#include "ProcessGet.c"
#include "ProcessPut.c"
#include "ProcessScd.c"
#include "ProcessSls.c"
#include "ProcessSpwd.c"
#include "ProcessHelp.c"
#include "PrintDir.c"
#include "Dispart.c"
#include "ConnectHost.c"

int main(int argc, char ** argv)
{
	
	if(argc != 3)
	{
		fprintf(stderr, "Usage:%s hostname portnumber\a\n", argv[0]);
		exit(1);
	}
	else
	{
		strcpy(HostName, argv[1]);
		if((PortNumber=atoi(argv[2])) < 0)
		{	
			fprintf(stderr, "Usage:%s hostname  portnumber\a\n", argv[0]);		
			exit(1);
		}
	}

	Preprocess();
	ConnectHost();
	Dispatch();
}
